seajs.config({
	plugins: ['shim', 'nocache', 'warning'],
	base: '/assets/script',
	alias: {
		'jquery': {
			src: 'lib/jquery.min.js',
			exports: 'jQuery'
		},
		'jquery.tmpl': {
			src: 'lib/jquery.tmpl.js',
			deps: ['jquery']
		},
		'jquery.html5uploader': {
			src: 'lib/jquery.html5uploader.min.js',
			deps: ['jquery']
		},
		'spine': {
			src: 'lib/spine/lib/spine.js',
			deps: ['jquery'],
			exports: 'Spine'
		},
		'spine.ajax': {
			src: 'lib/spine/lib/ajax.js',
			deps: ['spine']
		}
	}
})
seajs.use(['jquery', 'controller/app.js'], function($, App) {
	var application = new App({
		el: $('#browser')
	})
	$(function() {
		$(window).scroll(function(event) {
			var d = $('#browser-extra').position().top + $('#browser-extra').outerHeight()
			if ($(window).scrollTop() >= d) {
				if (!$('#browser-table-header').hasClass('fixed')) {
					$('#browser-table-header').addClass('fixed')
				}
			} else {
				if ($('#browser-table-header').hasClass('fixed')) {
					$('#browser-table-header').removeClass('fixed')
				}
			}
			$('#display').text($(window).scrollTop() + ' ' + $('#browser-extra').position().top + ' ' + $('#browser-extra').outerHeight())
		})
		$('#user-link').click(function(event) {
			$('#user-panel').slideToggle('fast')
		})
	})
})